﻿<Window x:Class="Adaptive.ReactiveTrader.ControlClient.GUI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ReactiveTrader Server" 
        Topmost="{Binding WindowAlwaysOnTop, Mode=OneWay}"
        Height="350" 
        Width="450">
    <Window.Style>
        <Style TargetType="Window">
            <Setter Property="Icon" Value="adaptive-logo.png"/>
        </Style>
    </Window.Style>
    <Control.Resources>
        <ResourceDictionary Source="SliderStyles.xaml"/>
    </Control.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0" Text="Server state:" Margin="4" />
        <TextBlock Grid.Row="0" Grid.Column="1" Margin="4" Text="{Binding ServerStatus, Mode=OneWay}" />
        <CheckBox Grid.Row="0" Grid.Column="2" Margin="4" IsChecked="{Binding WindowAlwaysOnTop, Mode=TwoWay}" Content="Always On Top" />
          
        <TextBlock Grid.Row="1" Grid.Column="0" Text="Desired Throughput" Margin="4"/>
        <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="4" >
            <TextBox Text="{Binding DesiredThroughput, Mode=TwoWay}" Width="40" />
            <TextBlock Text=" msg/sec"/>
        </StackPanel>
        <Button Grid.Row="1" Grid.Column="2" Margin="4" Command="{Binding RefreshCommand}" Content="Refresh" />
        
        <DataGrid Grid.Row="2" Grid.ColumnSpan="3" ItemsSource="{Binding CurrencyPairs}" AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Header="CCY" Binding="{Binding Symbol}" Width="60"/>
                <DataGridTemplateColumn Header="Active">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Available, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding CanModify}" HorizontalAlignment="Center"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Stale">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Stale, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding CanModify}" HorizontalAlignment="Center"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="Comment" Binding="{Binding Comment}" Width="*"/>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</Window>
